package main.java.com.blog.service;


import com.blog.dao.UserMapper;
import com.blog.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Admin on 2017/5/31.
 */
@SuppressWarnings("ALL")
@Service("UserService")
public class UserServiceImpl implements UserService {
    @Autowired
    UserMapper userMapper;

    @Override
    public int addUser(User user) {
        return userMapper.insertSelective(user);
    }

    @Override
    public User findByAccount(String userAccount) {
        return userMapper.selectByAccount(userAccount);
    }

    @Override
    public User findById(Integer userId) {
        return userMapper.selectByPrimaryKey(userId);
    }

    @Override
    public List<User> findAll() {
        return userMapper.selectAll();
    }

    @Override
    public int updateByUserAccount(User user) {
        return userMapper.updateByUserAccount(user);
    }
}
